package com.zhz.pubsub;

import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.zhz.utils.RabbitConstant;
import com.zhz.utils.RabbitUtils;

import java.util.Scanner;

/**
 * 
 * @date ：Created in 2021/01/30
 * @version: V1.0
 * @slogan: 天下风云出我辈，一入代码岁月催
 * @description: 生产者
 **/
public class WeatherBureau {


    public static void main(String[] args) throws Exception {
        Connection connection = RabbitUtils.getConnection();
        String input = new Scanner(System.in).next();
        Channel channel = connection.createChannel();

        //第一个参数交换机名字   其他参数和之前的一样
        channel.basicPublish(RabbitConstant.EXCHANGE_WEATHER,"" , null , input.getBytes());

        channel.close();
        connection.close();
    }
}
